var gamescaleX=1;
var gamescaleY=1;
var Dis_left = 0;
var Dis_top = 0;
function scale() {
    sizeHandler();
}


function sizeHandler() {
    window.scrollTo(0, 1);
    var canvaswidth = 512;
    var canvasheight = 768;
    var a = window.innerWidth, b = window.innerHeight;
    var factorx = a / canvaswidth;
    var factory = b / canvasheight;
    if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){
        if(a>=b){
            document.getElementById("orientate").style.display = "block";
            document.getElementById("game").style.display = "none";
        }
        else{
            document.getElementById("orientate").style.display = "none";
            var divGame = document.getElementById("game");
            divGame.style.display = "block";
            divGame.style.width = canvaswidth;
            divGame.style.height = b + "px";
            divGame.style.left = 0 + "px";
            if(a>512){
                Dis_left =   (a-canvaswidth)/2;
            }
            gamescaleX = 1;
            gamescaleY = factory;
        }
    }
    else{
        var divGame = document.getElementById("game");
        divGame.style.width = canvaswidth;
        divGame.style.height = b + "px";
        divGame.style.left = 0 + "px";
        gamescaleX = 1;
        gamescaleY = factory;
        if(a>512){
            Dis_left =   (a-canvaswidth)/2;
        }

    };





}




